home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Telnet Server 1.0 / events.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-14  |  1.0 KB  |  53 lines  |  [TEXT/KAHL]

  1. /*
  2. Copyright © 1994 Mikhail Fridberg. Part of this code is copyrighted by Steve Falkenburg
  3.  
  4. Telnet-based talk server/client
  5. */
  6.  
  7.  
  8. #include "const.h"
  9. #include "globals.h"
  10. #include "utils.h"
  11. #include "interface.h"
  12. #include "network.h"
  13. #include "queues.h"
  14. #include "events.h"
  15.  
  16. /*    event handling routine for dispatching non-null events.
  17.     we don't have much of a human interface, so we only handle
  18.     mousedowns.
  19. */
  20.  
  21. void HandleEvent(EventRecord *ev)
  22. {
  23.     if (HandleDialogEvents(ev))
  24.         return;
  25.     
  26.     switch (ev->what) {
  27.         case mouseDown:
  28.             HandleMouseDown(ev->where);
  29.             break;
  30.     }
  31. }
  32.  
  33.  
  34. /*    event handling routine for null-events.  this is where we check the queues
  35.     to see if we have anything in the "completed" queue.  if so, we call
  36.     ProcessConnection with the queue element parameter block which we receive,
  37.     and update our queue counter display.
  38. */
  39.  
  40. void HandleIdleTime(EventRecord *ev)
  41. {
  42.     MyQElemPtr pBlock;
  43.     
  44.     HandleDialogEvents(ev);
  45.     UpdateNumberList();
  46.     
  47.     while (pBlock = GetCompletedPBlock()) {
  48.         ProcessConnection(pBlock);
  49.     }
  50.  
  51.     UpdateNumberList();
  52. }
  53.